<?php

namespace App\Http\Controllers;

use EasyWeChat\Foundation\Application;

use Illuminate\Http\Request;

use App\Http\Requests;

class MenuController extends Controller
{
    //
    public $menu;

    public function __construct(Application $menu){
      $this->menu = $menu;

    }

    //获取菜单
    public function allmnue(){
      return $this->menu->current();
    }

    //添加菜单
    public function menu(){
      $buttons = [
          [
              "type" => "click",
              "name" => "点我",
              "key"  => "CLICK_ME"
          ],
          [
              "name"       => "菜单",
              "sub_button" => [
                  [
                      "type" => "view",
                      "name" => "菜单一",
                      "url"  => "https://github.com/weilai129/weilai/"
                  ],
                  [
                      "type" => "view",
                      "name" => "菜单二",
                      "url"  => "https://github.com/weilai129/weilai/"
                  ],
                  [
                      "type" => "click",
                      "name" => "打赏",
                      "key" => "ON_LIKE"
                  ],
              ],
          ],
      ];

      $this->menu->add($buttons);
    }


}
